package com.cmos.um.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONObject;
import com.cmos.um.iservice.IAgentSV;
import com.cmos.um.iservice.IHumanTaskSV;
import com.cmos.um.utils.Result;
import com.cmos.um.utils.ResultUtil;
import com.cmos.um.utils.RetMap;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/humanTask")
public class HumanTaskController {
    @Reference
    private IHumanTaskSV iHumanTaskSV;


    /**
     *渐进式外呼
     * @param params
     * @return
     */
    @PostMapping("/save")
    public Result save(@RequestBody JSONObject params){
        if (!params.containsKey("params")) {
            return ResultUtil.error("-9999","入参不符合规范");
        }
        return iHumanTaskSV.save(params);
    }

    /**
     *渐进式外呼
     * @param params
     * @return
     */
    @PostMapping("/update")
    public Result update(@RequestBody JSONObject params){
        if (!params.containsKey("params")) {
            return ResultUtil.error("-9999","入参不符合规范");
        }
        return iHumanTaskSV.update(params);
    }
}
